clear
est clear

	use "$input/full_geoid_pair_panel.dta"
	
	bysort from_geoid: egen year1=min(move_year)
	g fixed_pop1=tot_pop if move_year==year1
		bysort from_geoid: egen fixed_pop=min(fixed_pop1)
		drop fixed_pop1
		
	
	duplicates drop from_geoid move_year, force

		bysort move_year: egen wt_exposure=wtmean(home_total_storms), weight(tot_pop)
		bysort move_year: egen wt_exposure2=wtmean(home_total_storms), weight(fixed_pop)
		bysort move_year: egen wt_exposure_fema=wtmean(home_total_storms_fema), weight(tot_pop)
		bysort move_year: egen wt_exposure_fema2=wtmean(home_total_storms_fema), weight(fixed_pop)

	

		
	
	
	twoway (line wt_exposure move_year, lp(solid) lc("0 45 114")) ///
			(line wt_exposure2 move_year, lp(solid) lc(gs5)) ///
			(line wt_exposure_fema move_year, lp(dash) lc("252 89 16")) ///
			(line wt_exposure_fema2 move_year, lp(dash) lc(gs5) ///
		ytitle("Weighted Average Exposure" "to Storms",size(vlarge)) ysize(8) xsize(8) ylabel(0(2)8,labsize(vlarge)) xtitle("") xlabel(,labsize(vlarge) angle(45))legend(col(2) ring(0) position(6) order(1 3 2 4) label(1 "All storms") label(2 "Baseline exposure:" "all storms") label(3 "FEMA storms") label(4 "Baseline exposure:" "FEMA storms") size(*1.15) region(lstyle(solid) lwidth(0.25))))
		
		graph export "$figures/fig_3a.png", as(png) replace
		
	
	
	
	